define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'business.district_manage/index/district_id/'+district_id,
        add_url: 'business.district_manage/add/district_id/'+district_id,
        edit_url: 'business.district_manage/edit',
        delete_url: 'business.district_manage/delete',
        export_url: 'business.district_manage/export',
        modify_url: 'business.district_manage/modify',
    };

    var Controller = {

        index: function () {console.log(district_id);
            ea.table.render({
                init: init,
               // where:district_id?{filter:'{"district_id":"'+district_id+'"}',op:'{"district_id":"="}'}:{},
                toolbar: ['refresh', 'add', 'delete'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: '用户ID'},
                    /*{field: 'district_id', title: '商圈ID',hide:true,searchValue:district_id},*/
                    {field: 'role', title: '角色',selectList:{3:'所属人',4:'管理员'}},
                    {field: 'nickname', title: '昵称'},
                    {field: 'avatar', title: '头像',templet: ea.table.image,search:false},
                    {field: 'phone', title: '手机号'},
                    {width: 250, title: '操作', templet: ea.table.tool,
                        operat: ['delete']},
                ]],
                done: function () {
                    $(".layui-table-body>table>tbody>tr").each(function (index, val) {
                        $($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
                    });
                },
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
    };
    return Controller;
});